import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { getBranchList } from '/@/api/system/system';
// import { h } from 'vue';
// import { Switch } from 'ant-design-vue';
// import { setRoleStatus } from '/@/api/demo/system';
// import { useMessage } from '/@/hooks/web/useMessage';

export const columns: BasicColumn[] = [
  {
    title: '角色名称',
    dataIndex: 'roleName',
    width: 200,
  },
  {
    title: '角色代码',
    dataIndex: 'roleCode',
    width: 180,
  },
  {
    title: '所属机构',
    dataIndex: 'branchName',
    width: 180,
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 180,
  },
  {
    title: '备注',
    dataIndex: 'memo',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'roleName',
    label: '角色名称',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'roleCode',
    label: '角色代码',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'branchInnercode',
    label: '所属机构',
    component: 'ApiTreeSelect',
    colProps: { span: 6 },
    componentProps: {
      api: getBranchList,
      params: {
        isSelect: 'Y',
      },
    },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'branchInnercode',
    label: '所属机构',
    component: 'TreeSelect',
    required: true,
  },
  {
    field: 'roleName',
    label: '角色名称',
    required: true,
    component: 'Input',
  },
  {
    field: 'roleCode',
    label: '角色代码',
    required: true,
    component: 'Input',
  },
  {
    label: '备注',
    field: 'memo',
    component: 'InputTextArea',
  },
];
